﻿using System;
using System.Collections.Generic;
using System.Web;
using WAD.DAL;
using WAD.WEB.AppCode;
using WAD.Model;

namespace WAD.WEB.API.Tool
{
    /// <summary>
    /// SharedUser 的摘要说明
    /// </summary>
    public class SharedUser : AjaxBase
    {
        public override void AjaxMethodDispatch(String identity)
        {
            switch (identity)
            {
                case "sharedlist": this.SharedList(); break;
            }
        }
        [QD.Web.Ajax.AjaxMethod]
        public void SharedList()
        {
            int page = Parse.Int("page", 1);
            int pagesize = Parse.Int("pagesize", 20);
            int user_id = Parse.Int("user_id", 0);

            if (pagesize > 100) pagesize = 100;
            if (pagesize < 0) pagesize = 20;

            string where = "";
            if (user_id > 0)
                where = " user_id=" + user_id.ToString();
            PageData pg = DaoShared.GetListPage("id,url_title,url_logo,article_logo,article_title,click,type,article_id,advert_id,url,[date]", " click desc", page, pagesize, where, "v_shared");
            if (pg.itemCount == 0)
                DataEmpty();
            Success(pg);
        }
    }
}